@extends("agent.layouts.main")
<style>
	.my-ver-align {vertical-align: -2px;}
	.btn-link {color: gray;}
	.table {font-size: 14px;}
</style>
@section("content")
<div class="container-fiuld p-3">
    <div class="card">
        <div class="card-body">
            <div class="row mt-3 mb-3">
                <div class="col-lg-12">
                    <form class="form-inline">						
                        <label class="ml-3">时间：</label>                 
						<input type="text" name="start_time" id="start_time" class="layui-input test-laydate-item form-control mr-3" style="border-color:#ced4da" value="{{$start_time}}" placeholder="时间" lay-key="1">
                        <button type="button" class="btn btn-primary ml-5 mr-3 search">查询</button>
                        <button type="reset" class="btn btn-secondary">重置</button>
                        <button type="button" class="ml-5 btn btn-info export">导出</button>
                    </form>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12 table-responsive">
                    <table class="table">
                        <thead class="thead-light">
							<tr class="text-dark">
								<th>时间</th>
								<th>公会ID/名称</th>
								<th>礼物收入（洽贝）</th>
								<th>语音收入（洽贝）</th>
								<th>视频收入（洽贝）</th>
								<th>邮票收入（洽贝）</th>
								<th>收入提成比例</th>                            
								<th>公会收入(元)</th>
							</tr>
                        </thead>
                        <tbody>
							@foreach($earning as $v)	
							<tr>
								<td>{{$v['date']}}</td>
								<td>{{$v['guild']}}/{{$v['title']}}</td>
								<td>{{$v['sum_gift']}}</td>
								<td>{{$v['sum_voice']}}</td>
								<td>{{$v['sum_live']}}</td>
								<td>{{$v['sum_stamp']}}</td>
								<td>{{$v['cale']}}</td>
								<td>{{$v['sum_guild']}}</td>
							</tr>
							@endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div style="text-align: right;">
		@if(!empty($earning))
		{{ $earning->links('agent.layouts.paginate') }}
		@endif;
		</div>       
    </div>
</div>
@endsection
@section("js")
<script type="text/javascript">
    layui.use(['form', 'ori', "laydate"], function () {
        var form = layui.form,
            ori = layui.ori,
            dialog = layui.dialog,
            $ = layui.$
        laydate = layui.laydate;
        var start_time = '';
        lay('.test-laydate-item').each(function () {
            laydate.render({
                elem: this
                , trigger: 'click'
            });
        });
        $('.search').click(function () {
			var start_time = $("#start_time").val();
            location.href = "{{ route('earninglist') }}"+'?start_time='+ start_time;
        });
		$('.export').click(function () {
			var start_time = $("#start_time").val();
            location.href = "{{ route('exportearning') }}"+'?start_time='+ start_time;
        });
		//重置功能调用的方法
        ori.reset("[type=reset]");
    });
</script>
@endsection
